<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="description" content="Metro, a sleek, intuitive, and powerful framework for faster and easier web development for Windows Metro Style.">
    <meta name="keywords" content="HTML, CSS, JS, JavaScript, framework, metro, front-end, frontend, web development">
    <meta name="author" content="Sergey Pimenov and Metro UI CSS contributors">

    <link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />
    <title>Tab Control :: Metro UI CSS - The front-end framework for developing projects on the web in Windows Metro Style</title>

    <link href="css/metro.css" rel="stylesheet">
    <link href="css/metro-icons.css" rel="stylesheet">
    <link href="css/metro-responsive.css" rel="stylesheet">
    <link href="css/metro-schemes.css" rel="stylesheet">

    <link href="css/docs.css" rel="stylesheet">

    <script src="js/jquery-2.1.3.min.js"></script>
    <script src="js/metro.js"></script>
    <script src="js/docs.js"></script>
    <script src="js/prettify/run_prettify.js"></script>
    <script src="js/ga.js"></script>
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

</head>
<body>
    <div class="container page-content">
        <h1><a href="index.html" class="nav-button transform"><span></span></a>&nbsp;Tab Control</h1>

        @@adsense

        <div class="example" data-text="example">
            <div class="grid responsive">
                <div class="row cells2">
                    <div class="cell">
                        <h5>.tabcontrol</h5>
                        <div class="tabcontrol" data-role="tabcontrol">
                            <ul class="tabs">
                                <li><a href="#frame_1_1">Tab 1</a></li>
                                <li><a href="#frame_1_2">Tab 2</a></li>
                                <li class="disabled"><a href="">Tab 3</a></li>
                            </ul>
                            <div class="frames bg-grayLight">
                                <div class="frame" id="frame_1_1">1</div>
                                <div class="frame" id="frame_1_2">2</div>
                            </div>
                        </div>
                        <h5>.tabcontrol2</h5>
                        <div class="tabcontrol2" data-role="tabcontrol">
                            <ul class="tabs">
                                <li><a href="#frame_5_1">Tab 1</a></li>
                                <li><a href="#frame_5_2">Tab 2</a></li>
                                <li class="disabled"><a href="">Tab 5</a></li>
                            </ul>
                            <div class="frames">
                                <div class="frame" id="frame_5_1">1</div>
                                <div class="frame" id="frame_5_2">2</div>
                            </div>
                        </div>
                    </div>
                    <div class="cell">
                        <h5>.tabcontrol & .tabs-bottom</h5>
                        <div class="tabcontrol tabs-bottom" data-role="tabcontrol">
                            <div class="frames bg-grayLight">
                                <div class="frame" id="frame_2_1">1</div>
                                <div class="frame" id="frame_2_2">2</div>
                            </div>
                            <ul class="tabs tab-bottom">
                                <li class="active"><a href="#frame_2_1">Tab 1</a></li>
                                <li><a href="#frame_2_2">Tab 2</a></li>
                                <li class="disabled"><a href="">Tab 3</a></li>
                            </ul>
                        </div>

                        <h5>.tabcontrol2 & .tabs-bottom</h5>
                        <div class="tabcontrol2 tabs-bottom" data-role="tabcontrol">
                            <div class="frames">
                                <div class="frame" id="frame_6_1">1</div>
                                <div class="frame" id="frame_6_2">2</div>
                            </div>
                            <ul class="tabs tab-bottom">
                                <li><a href="#frame_6_1">Tab 1</a></li>
                                <li><a href="#frame_6_2">Tab 2</a></li>
                                <li class="disabled"><a href="">Tab 3</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="example" data-text="code">
            <h5>HTML, tabs on top</h5>
            <pre class="prettyprint linenums"><code>
                &lt;div class="tabcontrol"&gt;
                    &lt;ul class="tabs"&gt;
                        &lt;li&gt;&lt;a href="#frame_id"&gt;Caption&lt;/a&gt;&lt;/li&gt;
                        ...
                        &lt;li&gt;&lt;a href="#frame_id"&gt;Caption&lt;/a&gt;&lt;/li&gt;
                    &lt;/ul&gt;

                    &lt;div class="frames"&gt;
                        &lt;div class="frame" id="frame_id"&gt;1&lt;/div&gt;
                        ...
                        &lt;div class="frame" id="frame_id"&gt;4&lt;/div&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            </code></pre>

            <h5>HTML, tabs on bottom</h5>
            <pre class="prettyprint linenums"><code>
                &lt;div class="tabcontrol tabs-bottom"&gt;
                    &lt;div class="frames"&gt;
                        &lt;div class="frame" id="frame_id"&gt;1&lt;/div&gt;
                        ...
                        &lt;div class="frame" id="frame_id"&gt;4&lt;/div&gt;
                    &lt;/div&gt;

                    &lt;ul class="tabs"&gt;
                        &lt;li&gt;&lt;a href="#frame_id"&gt;Caption&lt;/a&gt;&lt;/li&gt;
                        ...
                        &lt;li&gt;&lt;a href="#frame_id"&gt;Caption&lt;/a&gt;&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/div&gt;
            </code></pre>
        </div>

        <div class="example" data-text="code">
            <h5>Declarative style</h5>
            <pre class="prettyprint linenums"><code>
                &lt;div class="tabcontrol" data-role="tabcontrol"&gt;
                ...
                &lt;/div&gt;
            </code></pre>

            <h5>Javascript style</h5>
            <pre class="prettyprint linenums"><code>
                &lt;div class="tabcontrol" id="tab-control"&gt;
                ...
                &lt;/div&gt;

                &lt;script&gt;
                    $(function(){
                        $("#tab-control").tabcontrol();
                    });
                &lt;/script&gt;
            </code></pre>
        </div>

        <h3>Options</h3>
        <table class="table bordered border">
            <thead>
            <tr>
                <td>Parameter</td>
                <td>Data-*</td>
                <td>Type</td>
                <td>Default value</td>
                <td>Description</td>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>openTarget</td>
                <td>data-open-target</td>
                <td>string</td>
                <td>false</td>
                <td>ID of frame to can be opened on tabcontrol init</td>
            </tr>
            <tr>
                <td>saveState</td>
                <td>data-save-state</td>
                <td>boolean</td>
                <td>false</td>
                <td>if true active tab saved in localStorage</td>
            </tr>
            </tbody>
        </table>

        <div class="example" data-text="example">
            <div class="grid responsive">
                <div class="row cells2">
                    <div class="cell">
                        <h5>openTarget</h5>
                        <div class="tabcontrol" data-role="tabcontrol" data-open-target="#frame_3_2">
                            <ul class="tabs">
                                <li><a href="#frame_3_1">Tab 1</a></li>
                                <li><a href="#frame_3_2">Tab 2</a></li>
                                <li><a href="#frame_3_3">Tab 3</a></li>
                            </ul>
                            <div class="frames bg-grayLight">
                                <div class="frame" id="frame_3_1">1</div>
                                <div class="frame" id="frame_3_2">2</div>
                                <div class="frame" id="frame_3_3">3</div>
                            </div>
                        </div>
                        <p class="text-small">
                            Tab control initialized with active tab 2. Tab can not be <span class="tag">disabled</span>.
                        </p>
                    </div>

                    <div class="cell">
                        <h5>saveSate</h5>
                        <div class="tabcontrol" data-role="tabcontrol" data-save-state="true" id="tabcontrol_4">
                            <ul class="tabs">
                                <li><a href="#frame_4_1">Tab 1</a></li>
                                <li><a href="#frame_4_2">Tab 2</a></li>
                                <li><a href="#frame_4_3">Tab 3</a></li>
                            </ul>
                            <div class="frames bg-grayLight">
                                <div class="frame" id="frame_4_1">1</div>
                                <div class="frame" id="frame_4_2">2</div>
                                <div class="frame" id="frame_4_3">3</div>
                            </div>
                        </div>
                        <p class="text-small">
                            Tab control initialized with saved tab. Select tab and reload page. This future required <span class="tag alert">ID</span> attribute for <span class="tag">tabcontrol</span>
                        </p>
                    </div>
                </div>
            </div>
        </div>

        <h3>Events</h3>
        <table class="table bordered border">
            <thead>
            <tr>
                <td>Event</td>
                <td>Data-*</td>
                <td>Params</td>
                <td>Description</td>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>onTabClick</td>
                <td style="white-space: nowrap">data-on-tab-click</td>
                <td>(tab)</td>
                <td>The event fired when tab click. This function can return true or false. If returned value is false, tab no switched</td>
            </tr>
            <tr>
                <td>onTabChange</td>
                <td style="white-space: nowrap">data-on-tab-change</td>
                <td>(tab)</td>
                <td>The event fired when the tab is changed</td>
            </tr>
            </tbody>
        </table>

        <div class="example" data-text="code">
            <pre class="prettyprint linenums"><code>
                &lt;div class="tabcontrol"
                     data-role="tabcontrol"
                     data-on-tab-click="tab_click"
                     data-on-tab-change="tab_change"&gt;
                    ...
                &lt;/div&gt;

                &lt;script&gt;
                    function tab_click(tab){
                        console.log(tab);
                        return true;
                    }

                    function tab_change(tab){
                        console.log(tab);
                    }
                &lt;/script&gt;
            </code></pre>

            <pre class="prettyprint linenums"><code>
                &lt;div class="tabcontrol" id="tabcontrol"&gt;
                    ...
                &lt;/div&gt;

                &lt;script&gt;
                    $(function(){
                        $("#tabcontrol).tabcontrol({
                            onTabClick: function(tab){...},
                            onTabChange: function(tab){...}
                        });
                    })
                &lt;/script&gt;
            </code></pre>
        </div>

        <h3>Additional</h3>
        <p>
            If <span class="tag">tab</span> has class <span class="tag">disabled</span>, then <strong>tab</strong> not be clicked.
        </p>
    </div>

    @@hit

</body>
</html>